'''

Created on Feb 21, 2013
@Author: Rossi Kamal(rossi@khu.ac.kr)under Supervision of Professor Dr Choong Seon Hong(cshong@khu.ac.kr)

Given, X, MU and SIGMA(BIG)/VARIANCE-COVARIANCE MATRIX
Multi_variate_gaussian_distribution_density_function
=(1/((2*pi)**(N/2))*(SIGMA**(1/N)))*(e**((-1/N)*(x-mu)**t(SIGMA**(-1))*(x-mu) #SIGMA-(big)-variance-covariance matrix


Notable that, x is k*N matrix, Mean is 1*N Matrix and SIGMA is N*N, where we are considering N-dimensional or N-Variate Gaussian Distribution 
'''
from math import *
import numpy.linalg as la
class MultiVariateGaussianDistributionProcessor:
    def __init__(self,N, multi_variate_mean_matrix,multi_variate_variance_covariance_matrix, multi_variate_x):
            self.N=N
            self.multi_variate_mean_matrix=multi_variate_mean_matrix
            self.multi_variate_variance_covariance_matrix=multi_variate_variance_covariance_matrix 
            self.multi_variate_x=multi_variate_x
    def calculate_bi_variate_gaussian_distribution(self):
        multi_variate_normalizer=1/((2*pi)*(self.N/2))*sqrt(self.multi_variate_variance_covariance_matrix)
        multi_variate_distance_between_x_N_mean=exp(-.5*((self.multi_variate_x-self.multi_variate_mean_matrix).transpose())*(la.inv(self.multi_variate_variance_covariance_matrix))*(self.multi_variate_x-self.multi_variate_mean_matrix))
        return multi_variate_normalizer*multi_variate_distance_between_x_N_mean
        
        
        